<template>
  <el-card shadow="never">
    <template slot="header">
      <span>地图来源</span>
    </template>
    <el-select
      :value="value.platform"
      @input="
        (e) => {
          $emit('input', { ...value, platform: e })
        }
      "
      size="small"
      class="!w-full"
    >
      <el-option
        v-for="item in platforms"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      />
    </el-select>

    <div class="mt-6 mb-3">其他设置</div>
    <el-radio-group
      :value="value.setting"
      @input="
        (e) => {
          $emit('input', { ...value, setting: e })
        }
      "
      class="!flex flex-col gap-1"
    >
      <el-radio label="noFilter">不过滤</el-radio>
      <el-radio label="excludeMerchantWithoutContact"
        >排除没有联系方式的商家</el-radio
      >
      <el-radio label="onlyMerchantHasPhone">仅采集带有手机号的商家</el-radio>
    </el-radio-group>
  </el-card>
</template>

<script>
export default {
  name: 'Settings',
  props: {
    value: {
      type: Object,
      default: () => ({ platform: 'google', setting: 'noFilter' }),
    },
  },
  data() {
    return {
      platforms: [{ label: '谷歌地图', value: 'google' }],
    }
  },
  created() {
    if (!this.value.platform) {
      this.$emit('input', { platform: 'google', setting: 'noFilter' })
    }
  },
}
</script>
